#!/usr/bin/python3.7
# -*- coding: utf-8 -*-
# @Time    : 2021/3/7 19:55 下午
# @Author  : 白辉东
# @Email   : xyxk-huidong.bai@ximalaya.com
# @File    : result.py
# @Software: PyCharm


"""
单个用例结果封装类
1、唤醒小雅时间：从播放音频结束--->日志唤醒小雅标志时间
2、VAD结束时间：从VAD开始日志时间--->VAD日志结束时间
3、服务端相应时间（包含asr解析时间）：从VAD日志结束时间--->服务端返回结果的第一条日志
4、是否为兜底TTS（是否识别成功）
5、case是否正确执行
6、是否发生websocket断连
7、断网次数
"""


class Result(object):
    """
    结果集
    """
    # 是否唤醒成功
    __is_wakeup_success = False
    # 是否发生WebSocket断链
    __is_websocket_disconnect = False
    # 是否发生wifi断链
    __is_wifi_disconnect = False
    # 是否为兜底TTS
    __is_doudi_tts = False
    # asr识别结果
    __asr_result = ''
    # 音箱回复TTS
    __speaker_tts = ''
    # nlu识别domain
    __nlu_domain = ''
    # nlu识别intent
    __nlu_intent = ''
    # TTS开始播放标志是否存在
    __tts_start_exist = False
    # 资源播放的URL的payload是否存在
    __play_url_exist = False
    # 音箱执行动作结果
    __speaker_action = ''

    def __init__(self, query):
        query_text = query.query
        self.__query_text = query_text

    @property
    def is_wakeup_success(self):
        return self.__is_wakeup_success

    @is_wakeup_success.setter
    def is_wakeup_success(self, is_wakeup_success):
        self.__is_wakeup_success = is_wakeup_success

    @property
    def is_websocket_disconnect(self):
        return self.__is_websocket_disconnect

    @is_websocket_disconnect.setter
    def is_websocket_disconnect(self, is_websocket_disconnect):
        self.__is_websocket_disconnect = is_websocket_disconnect

    @property
    def is_wifi_disconnect(self):
        return self.__is_wifi_disconnect

    @is_wifi_disconnect.setter
    def is_wifi_disconnect(self, is_wifi_disconnect):
        self.__is_wifi_disconnect = is_wifi_disconnect

    @property
    def is_doudi_tts(self):
        return self.__is_doudi_tts

    @is_doudi_tts.setter
    def is_doudi_tts(self, is_doudi_tts):
        self.__is_doudi_tts = is_doudi_tts

    @property
    def asr_result(self):
        return self.__asr_result

    @asr_result.setter
    def asr_result(self, asr_result):
        self.__asr_result = asr_result

    @property
    def query_text(self):
        return self.__query_text

    @property
    def speaker_tts(self):
        return self.__speaker_tts

    @speaker_tts.setter
    def speaker_tts(self, speaker_tts):
        self.__speaker_tts = speaker_tts

    @property
    def nlu_domain(self):
        return self.__nlu_domain

    @nlu_domain.setter
    def nlu_domain(self, nlu_domain):
        self.__nlu_domain = nlu_domain

    @property
    def nlu_intent(self):
        return self.__nlu_intent

    @nlu_intent.setter
    def nlu_intent(self, nlu_intent):
        self.__nlu_intent = nlu_intent

    @property
    def tts_start_exist(self):
        return self.__tts_start_exist

    @tts_start_exist.setter
    def tts_start_exist(self, tts_start_exist):
        self.__tts_start_exist = tts_start_exist

    @property
    def play_url_exist(self):
        return self.__play_url_exist

    @play_url_exist.setter
    def play_url_exist(self, play_url_exist):
        self.__play_url_exist = play_url_exist

    @property
    def speaker_action(self):
        return self.__speaker_action

    @speaker_action.setter
    def speaker_action(self, speaker_action):
        self.__speaker_action = speaker_action
